jQuery(document).ready(function($) {
	$("ul.woo_courses > li").click(function(e) {
		window.location.href = $(location).attr('href') + "&course_id=" + $(this).attr("id").replace("course_","");
	});
	
	var dates = [];
	$(".woo_date").each(function(e) { dates.push($(this).attr('id')); });

	$("#testcalendar").datepicker({
		dateFormat: "dd/mm/yy",
		onSelect: function(dateText, inst) {
			var here = $.inArray(dateText, dates);
			if (here > -1) {
				window.location = $("div[id*='"+dateText+"']").next().find('a').attr('href');
			}
		},
		beforeShowDay: function(date) {
			var currDate = $.datepicker.formatDate( "dd/mm/yy", date);
			var here = $.inArray(currDate, dates);
             if (here > -1) {
              return [true, 'css-class-to-highlight', "Click to see lecture"];

              }
              return [true, ''];
           }
	});

});